// 员工列表
import request from '@/utils/request';
import {object2Url} from "@/utils/trans";

// 新增员工
export async function staffAdd (data) {
  const res = await request.post('/business/staff/add', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 查询员工
export async function staffPage (data) {
  const res = await request.post('/business/staff/pageList', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 删除员工
export async function staffDel (data) {
  const res = await request.post('/business/staff/delete', data)
  if (res.data.code === 2000) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 修改员工
export async function staffUpdate (data) {
  const res = await request.post('/business/staff/update', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

